home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / num.zip / NUM.C next >
Text File  |  1986-11-29  |  902b  |  44 lines

  1. /*************************************************************************
  2.  
  3. NUM
  4.  
  5. This program will switch the num-lock setting.  
  6.  
  7. Usage:
  8.    NUM or NUM ON  turns on num-lock.
  9.    NUM OFF turns it off.
  10.    
  11. Written by Steven Stern, JMB Realty Corporation, November, 1986
  12.  
  13. Compilation note for Mark Williams C:  Requires the large model, i.e.,
  14.    cc -vlarge num.c
  15.    
  16. *************************************************************************/
  17.    
  18. #include <ctype.h>
  19. main (argc, argv)
  20.  
  21. char *argv[];
  22. int argc;
  23.  
  24. {
  25. unsigned status_byte;
  26. int on = 0;
  27. int i;
  28.  
  29. if (argc == 2) 
  30.    {
  31.    for(i=0;argv[1][i]!='\0';i++) argv[1][i]=_toupper(argv[1][i]);
  32.    if (strcmp("OFF",argv[1])==0) on=-1;
  33.    }
  34.  
  35. status_byte=peekb(0x417,0);
  36.  
  37. if (on==0)
  38.     status_byte=status_byte | 0x20;
  39.    else
  40.     if (status_byte & 0x20) status_byte=status_byte ^ 0x20;
  41.  
  42. pokeb(0x417,0,status_byte);
  43. }
  44.